<template>
    <el-dialog :title="title" :visible.sync="open" width="90%" append-to-body :close-on-click-modal="false"
               v-dialogDrag>
        <div style="margin-left: 10px;">
          <div style=" display: flex;align-items: center;margin-bottom: 10px;margin-top: 10px;">
          </div>
            <el-form ref="form" :rules="rules" label-width="120px">
              <el-table :data="columns" ref="dragTable" row-key="id" >
                <el-table-column type="selection" width="55" align="center"/>
                <el-table-column label="工序编码" align="center" prop="nos"/>
                <el-table-column label="工序名称" align="center" prop="tongzhiNo"/>
                <el-table-column label="准备时间" align="center" prop="fahuoDate" width="180">
                  <!-- <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.fahuoDate, '{y}-{m}-{d}') }}</span>
                  </template> -->
                </el-table-column>
                <el-table-column label="生产时间" align="center" prop="jiaohuoDate" width="180">
                  <!-- <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.jiaohuoDate, '{y}-{m}-{d}') }}</span>
                  </template> -->
                </el-table-column>
                <!-- <el-table-column label="是否启用" align="center" prop="linkman"/> -->
                <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="140">
                  <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-edit"  @click="modify(scope.row)">修改</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-form>
          <yiFahuo-list ref="fahuomingxiList" @ok="getList"></yiFahuo-list>
          <lvFahuoBohui-form ref="modifyfahuomingxi" @ok="getList"></lvFahuoBohui-form>
        </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
    import { getAction,addAction,getById} from '@/api/manage'
    import YiFahuoList from '@/views/develop/lvYifahuomingxi/YiFahuoList'
    import LvFahuoBohuiForm from '@/views/develop/lvYifahuomingxi/module/LvFahuoBohuiForm'
    export default {
      name: "GoodsGongxuForm",
      dicts: [  'goods_customer'],
      components: {
        YiFahuoList,
        LvFahuoBohuiForm,
      },
      data() {
        return {
          title: "工艺工序",
          open: false,
          // 遮罩层
          loading: true,
          // 选中数组
          ids: [],
          rows: [],
          rules: {
          },
          // 非单个禁用
          single: true,
          // 非多个禁用
          multiple: true,
          // 显示搜索条件
          showSearch: true,
          // 总条数
          total: 0,
          // 销售信息管理表格数据
          dataList: [],
          columns: [{
            nos:'PROCESS543',
            tongzhiNo:'螺母下料',
            fahuoDate:'10-14',
            jiaohuoDate:'10-15',
          },{
            nos:'PROCESS559',
            tongzhiNo:'精磨内螺纹',
            fahuoDate:'10-14',
            jiaohuoDate:'10-15',
          },{
            nos:'PROCESS563',
            tongzhiNo:'车内螺纹',
            fahuoDate:'10-14',
            jiaohuoDate:'10-15',
          },{
            nos:'PROCESS583',
            tongzhiNo:'粗磨内螺纹',
            fahuoDate:'10-14',
            jiaohuoDate:'10-15',
          }],
          // 查询参数
          queryParams: {
            pageNum: 1,
            pageSize: 20000,
            nos: null,
            name: null,
            fahuoDate: null,
            jiaohuoDate: null,
            linkman: null,
            linktel: null,
            address: null,
            status: null,
            jingli: null,
            kehuId: null,
            kehuName: null,
            taxNo: null,
            taxCode: null,
            taxDate: null,
            taxMoney: null,
            taxShengyu: null,
            taxAllmoeny: null,
            allMoney: null,
            shengyu: null,
            yihui: null,
            daohuoDate: null,
            daohuoFile: null,
            tongzhiId: null,
            tongzhiNo: null,
            params: {},
          },
          url: {
            list:'/lvYifahuo/lvYifahuo/list',
          },
          tableMaxHeight: window.innerHeight - 320,
        };
      },
      created() {
        // this.intDictsForPrj();
        window.addEventListener('resize', this.getTableHeight);
      },
      destroyed() {
        window.removeEventListener('resize', this.getTableHeight);
      },
      methods: {
        gongxuShow() {
            this.open = true
        },
        modify(row){
          this.$refs.modifyfahuomingxi.showModifyMingxi(row);
        },
        xiangqing(row){
          this.$refs.fahuomingxiList.showMingxi(row);
        },
        // 取消按钮
        cancel() {
          this.open = false;
          this.reset();
        },
        getTableHeight() {
          this.tableHeight = window.innerHeight - 320
        },
        showFahuodanList(row){
          this.queryParams.tongzhiId=row.id;
          this.open=true;
          this.getList();
        },
        /** 查询销售信息管理列表 */
        getList() {
          this.loading = true;
          getAction(this.url.list, this.queryParams).then(response => {
            this.columns = response.rows;
            this.total = response.total;
            this.loading = false;
          });
        },
        /** 搜索按钮操作 */
        handleQuery() {
          this.queryParams.pageNum = 1;
          this.getList();
        },
      }
    };
  </script>
  